{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>心动列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">  

                    <form name="admin_list_sea" class="form-search" method="post" action="{:url('index')}">

                        <div class="col-sm-3">
                            <div class="input-group">
                                <input type="text" id="user" class="form-control" name="user" value="{$user}" placeholder="查询该用户心动的用户" />

                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="input-group">
                                <input type="text" id="to_user" class="form-control" name="to_user" value="{$to_user}" placeholder="查询心动该用户的用户" />
                                <span class="input-group-btn">
                                    <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                                </span>
                            </div>
                        </div>
                    </form>                         
                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th width="3%">ID</th>
                                <th width="8%">用户</th>
                                <th width="8%">心动对象</th>
                                <th width="10%">心动程度</th>
                                <th width="10%">心动时间</th>
                                <th width="10%">操作</th>
                            </tr>
                        </thead>
                        <script id="list-template" type="text/html">
                            {{# for(var i=0;i<d.length;i++){  }}
                                <tr class="long-td">
                                    <td>{{d[i].id}}</td>
                                    <td>{{d[i].name}}</td>                                 
                                    <td>{{d[i].to_name}}</td>
                                    <td>{{# if(d[i].is_spe==1){ }}
                                        <i style="color: red">特别心动</i>
                                        {{# }else{ }}
                                        <i style="color: green">心动</i>
                                        {{# } }}</td>
                                   
                                    <td>{{d[i].create_time}}</td>

                                    <td>
                                        {if condition="stripos($menulist,'44') || $showBut eq 1 "}

                                        <a href="javascript:;" onclick="del_heart({{d[i].id}})" class="btn btn-danger btn-xs btn-outline">
                                            <i class="fa fa-trash-o"></i> 删除</a>
                                        {/if}
                                    </td>
                                </tr>
                            {{# } }}
                        </script>
                        <tbody id="list-content"></tbody>
                    </table>
                    <div id="AjaxPage" style="text-align:right;"></div>
                    <div style="text-align: right;">
                        共{$count}条数据，<span id="allpage"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
   
    /**
     * [Ajaxpage laypage分页]
     * @param {[type]} curr [当前页]
     */
    Ajaxpage();
 
    function Ajaxpage(curr){
        var user=$('#user').val();
        var to_user=$('#to_user').val();
        $.getJSON('{:url("heart/index")}', {
            page: curr || 1,user:user,to_user:to_user
        }, function(data){      //data是后台返回过来的JSON数据
			$(".spiner-example").css('display','none'); //数据加载完关闭动画
            if(data==''){
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
            }else{
                var tpl = document.getElementById('list-template').innerHTML;
                laytpl(tpl).render(data, function(html){
                    document.getElementById('list-content').innerHTML = html;
                });
                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:'{$allpage}',//总页数
                    skip: true,//是否开启跳页
                    skin: '#1AB5B7',//分页组件颜色
                    curr: curr || 1,
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
                    }
                });
            }
        });
    }

    function import_excel(){
      location.href = '/admin/heart/import_excel.html';
  }
 

//编辑文章
function edit_heart(id){
    location.href = './edit_heart/heart_id/'+id+'.html';
}

function find_heart(id){
    location.href = './find_heart/heart_id/'+id+'.html';
}

//项目日历
function artlog(id){
    location.href = '../artlog/index/heart_id/'+id+'.html';
}


//删除文章
function del_heart(id){
    lunhui.confirm(id,'{:url("del_heart")}');
}

//文章状态
function heart_state(id){
    {if condition="stripos($menulist,'47') "}
    lunhui.status(id,'{:url("heart_state")}');
    {/if}
}



</script>
</body>
</html>